<?php

use yii\db\Migration;

/**
 * Class m191015_063449_action_log
 */
class m191015_063449_action_log extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $this->createTable('{{%action_log}}', [
            'id' => $this->primaryKey(),
            'admin_id' => $this->Integer()->notNull()->comment('管理员id'),
            'ip' => $this->string()->comment('登录ip'),
            'module' => $this->string()->comment('操作模块'),
            'function_data' => $this->text()->comment('操作数据'),
            'status' => $this->smallInteger()->notNull()->defaultValue(1)->comment('状态'),
            'created_at' => $this->integer()->notNull(),
            'updated_at' => $this->integer(),
            'deleted_at' => $this->integer(),
        ]);
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('{{%action_log}}');
        return false;
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m191015_063449_action_log cannot be reverted.\n";

        return false;
    }
    */
}
